package com.ssm.entity;

import java.io.Serializable;

public class AjaxResult implements Serializable{
    /** 是否成功 */
    private Boolean success;
    /** 数据 */
    private Object  data;
    /** 结果信息 */
    private String message;
    /** 返回码 */
    private String code;

    public Boolean getSuccess() {
        return success;
    }

    public void setSuccess(Boolean success) {
        this.success = success;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    /**
     * 成功返回的JSON格式  success为true  code为1
     * @param data 返回的数据
     */
    public AjaxResult(Object data) {
        this.success = true;
        this.code = "1";
        this.data = data;
    }

    /**
     * 失败返回的JSON格式   success为false
     * @param message 失败的提示信息
     * @param code  失败的状态码
     */
    public AjaxResult(String message, String code) {
        this.success = false;
        this.code = code;
        this.message = message;
    }
}
